import java.awt.event.ActionEvent;

import javax.swing.JButton;


public class Injury extends RandomEvent {

	String message;
	Member m;
	int injury;
	JButton ok;
	
	public Injury(MainCardPanel display, String message, Member m, int injury, Party p) {
		super(display, p);
		this.m = m;
		this.message = message;
		this.injury = injury;
		ok = new JButton("ok");
		ok.addActionListener(this);
		imageFilename = "injury.jpg";
		displayName = message;
	}
	@Override
	public void decay() {
		super.decay();
		if (dead)
			return;
		if (!fresh)
			dead = true;
	}

	@Override
	public JButton[] getResponseElements() {
		JButton[] ret = {ok};
		return ret;
	}
	
	public void actionPerformed(ActionEvent e) {
		super.actionPerformed(e);
		m.setHealth(m.getHealth()-injury);
		
	}
	public Member getVictim() {
		return m;
	}

}
